package com.feihong.yw189.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.feihong.yw189.R;

import java.util.ArrayList;

/**
 * Created by yucheng on 2017/12/11.
 */

public class MyAdapter extends BaseAdapter {
    private Context context;
    private ArrayList<String> list;

    public MyAdapter(Context context, ArrayList<String> list) {
        this.context = context;
        this.list = list;
    }

    public void upData(ArrayList<String> list) {
        this.list = list;
        notifyDataSetChanged();
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public String getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup viewGroup) {
        View view = View.inflate(context, R.layout.item_kdtc, null);
        TextView tv_ble = (TextView) view.findViewById(R.id.tv_kd);
        tv_ble.setText(getItem(position));
        return view;
    }

}
